/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/<a href="https://www.kaaction.com">KAA</a>"><a href="https://www.kaaction.com">KAA</a></a> All rights reserved.
 */
package com.kaaction.modules.eb.api;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kaaction.common.web.BaseController;
import com.kaaction.modules.eb.entity.UserLogin;
import com.kaaction.modules.eb.service.UserLoginService;

/**
 * 用户登入Controller
 * @author huanghaiming
 * @version 2017-04-17
 */
@Controller
@RequestMapping(value = "${adminPath}/eb/userLogin")
public class UserLoginController extends BaseController{
	
	@Autowired
	private UserLoginService userLoginService;
	
	@RequestMapping(value = "/list")
	public String list(UserLogin uLogin,HttpServletRequest request){
		return "modules/eb/userLoginForm";
	}
	
	/**
	 * 用户登入
	 * @param uLogin
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "userLogin")
	@ResponseBody
	public Map<String,String> userLogin(UserLogin uLogin,HttpServletRequest request){
		return userLoginService.selectUserLogin(uLogin,request);
	}
	
	/**
	 * 用户注册
	 * @param uLogin
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "userRegister")
	@ResponseBody
	public Map<String,String> userRegister(UserLogin uLogin,HttpServletRequest request){
		return userLoginService.inserUserRegister(uLogin,request);
	}
	
	/**
	 * 获取短息验证
	 * @param uLogin
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "captchaSends")
	public void captchaSends(UserLogin uLogin,HttpServletRequest request){
		 userLoginService.captchaSend(uLogin,request);
	}
	
	/**
	 * 更新用户
	 * @param uLogin
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "updatUser")
	public void updatUser(UserLogin uLogin,HttpServletRequest request){
		 userLoginService.updatUser(uLogin,request);
	}
}
